<script setup>
import { onMounted, ref } from "vue";
import * as echarts from "echarts";

let chart = ref();

function chartInit() {
  let myChart = echarts.init(chart.value);

  let option = {
    tooltip: {},
    series: [
      {
        type: "pie",
        radius: [20, 90],
        roseType: "area",
        data: [
          { value: 401, name: "行业一" },
          { value: 380, name: "行业二" },
          { value: 325, name: "行业三" },
          { value: 280, name: "行业四" },
          { value: 243, name: "行业五" },
          { value: 212, name: "行业六" },
        ],
        itemStyle: {
          borderRadius: 8,
        },
      },
    ],
  };
  myChart.setOption(option);
  window.addEventListener("resize", () => {
    myChart.resize();
  });
}
onMounted(() => {
  chartInit();
});
</script>

<template>
  <!-- 饼图  -->
  <div class="boxstyle" style="height: 230px">
    <div class="title">项目管理</div>
    <div ref="chart" style="width: 100%; height: 240px"></div>
  </div>
</template>

<style scoped></style>
